document.querySelector(".fanhui").onclick = function () {
    location.href = "./index.html"
}




function Datachange() {
    document.querySelector("#selectfile").onclick = function () {
        location.href = "./change.html"
    }
}

// cooker数据获取
function showWelcome() {
    let userphone = getCookie("userphone");
    let username = getCookie("username");
    if (userphone) {
        $("#welcome-box span").html(username);
        $("#welcome-box").show();
        $("#login-box").hide();
        $("#huiyuan").show();
        $(".money1").show();
    } else {
        $("#welcome-box").hide();
        $("#login-box").show();
        $("#huiyuan").hide();
        $(".money1").hide();
    }
}

let userid = getCookie("userid")
console.log(userid);

function logout() {

    removeCookie("province");
    removeCookie("userphone");
    removeCookie("city");
    removeCookie("detail");
    removeCookie("paytime");
    removeCookie("bookId");
    removeCookie("id");

    $("#welcome-box").hide();
    $("#login-box").show();
    $("#huiyuan").hide();
    $(".money1").hide();

    // DATAdelete()
}

function DATAdelete (){
    ajaxUsePromise02({
        url: `http://localhost:3000/vips/${userid}`,
        method: "delete"
    }).then(res => {
        console.log(res);
    })
}

window.onload = function () {
    showWelcome()
    $("#btnLogout").on("click", function () {
        logout()
        DATAdelete()
    })
    Datachange()
    
}